'use strict'

class image {

  constructor () {
    this.param = '/:name'
  }

  /**
   * 获取资源具体内容
   * @param {context} c
   * @returns 
   */
  async get (c) {
    try {
      await c.helper.pipe(`${c.service.storageDir}/images/${c.param.name}`, c.reply)
    } catch (err) {
      return c.status(404)
    }
  }

}

module.exports = image
